const moment = require('moment')

module.exports = function (files, fields) {
    var filename = files.file.name
    console.log(fields)
    var nameArray = filename.split('.');
    var type = nameArray[nameArray.length - 1];
    var name = '';
    for (var i = 0; i < nameArray.length - 1; i++) {
        name = name + nameArray[i];
    }
    var avatarName = fields.type + "_" + fields.username + "_" + moment().format("YYYY_MM_DD_HH_mm_ss") + '.' + type;
    return avatarName
}